package com.spring.framework.beans;

import com.spring.framework.core.FactoryBean;

/**
 * @author lb
 * @Title: BeanWrapper
 * @Description: TODO
 * @date 2018/10/10  16:10
 */
public class BeanWrapper extends FactoryBean {
    //会用到观察者模式
    //1、支持事件响应，会有一个监听
    private BeanPostProcessor postProcessor;

    public BeanPostProcessor getPostProcessor() {
        return postProcessor;
    }

    public void setPostProcessor(BeanPostProcessor postProcessor) {
        this.postProcessor = postProcessor;
    }

    private Object wrapperInstance;
    //原生的通过反射new出来的，要把它包装起来，存下来
    private Object originalInstance;

    public BeanWrapper(Object instance){

        this.originalInstance = instance;
        this.wrapperInstance = instance;
    }
    public Object getWrapperInstance(){
        return this.wrapperInstance;
    }
    //返回代理以后的class
    //可能会是这个$Proxy0
    public Class<?> getWrappedClass(){
        return this.wrapperInstance.getClass();
    }

}
